UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C2ndbY8RJNt8nApP2XNrfGXB2iZug+bP/Y/wmQ/DJN8=' 
WHERE 
  key_id = 'bbe4bbacb36bde20f0352d2ff807b8b13a5a8ee4f206069bde4f8bcd0d8633dd' 
  AND (
    token = 'C2ndbY8RJNt8nApP2XNrfGXB2iZug+bP/Y/wmQ/DJN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038