UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PaASt6gzAXDj92TqhSqBaS9gCuq4BbCseEH/+kixB04='
WHERE
key_id = 'e980e7092e49bc38c01c187487b4660a842bf242eac3d5cae2f0b1cfdacea179'
AND (
token = 'PaASt6gzAXDj92TqhSqBaS9gCuq4BbCseEH/+kixB04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)