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