UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FqbWrCEr5SUswvE9WFJ9BvgjB3f+oPfDXprGhD5kL4c='
WHERE
key_id = 'c5059952ac32d69046f682959aeed04592663add9ef5b14968a159999516a8e2'
AND (
token = 'FqbWrCEr5SUswvE9WFJ9BvgjB3f+oPfDXprGhD5kL4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)