UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o4dZcoQavpOAIp7q2WP3mtb4h64Ri+tU0VcQcSor5r4='
WHERE
key_id = '6143389437ce32199b15732c4f22d285d478704b41bf04cfc2861c89604b800b'
AND (
token = 'o4dZcoQavpOAIp7q2WP3mtb4h64Ri+tU0VcQcSor5r4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)