UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o3UcPHWvftmQWs8K2WLw/78G/aQzm6hOCGg3SHVxO1g=' 
WHERE 
  key_id = 'b137e1237f4760348bd47ec9a35ee06f62fbc75a4bb55ba42a32ba16b3fdc865' 
  AND (
    token = 'o3UcPHWvftmQWs8K2WLw/78G/aQzm6hOCGg3SHVxO1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037