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