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