UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aYv1XITqXfExkxdGSX9eNORfWyMVw9xPggk6fS1HB3w='
WHERE
key_id = 'dc763ca9e6ab8fafc12d4c4fe432667e6dbfb1dbb4c8017595a538da848b9316'
AND (
token = 'aYv1XITqXfExkxdGSX9eNORfWyMVw9xPggk6fS1HB3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)