UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7kdFBip2cFRvCF43E267wqXsvhtubIG1iyEzh9u74T8='
WHERE
key_id = 'a0f3535ea07aecacf3aaa4bf83cf288cbbbaa2a9784656974a51b956ad8e15bf'
AND (
token = '7kdFBip2cFRvCF43E267wqXsvhtubIG1iyEzh9u74T8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)