UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tVGwYGhkjGsJZADcpO43+ih8T+Du77xZxzkmOxRuu58='
WHERE
key_id = '07798d2d930ced1850d99f684bbca18a6efb73c2ef0c016710a0e8bd6895d2e0'
AND (
token = 'tVGwYGhkjGsJZADcpO43+ih8T+Du77xZxzkmOxRuu58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)