UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GsXs3CvV+OPaJVietH+rZtEeVcqoAawYbp1HFQNNYA8=' 
WHERE 
  key_id = 'e50715fb808154c3767f4b5f543ed6a4ad911c3fe13caa3c38425e024d7aa602' 
  AND (
    token = 'GsXs3CvV+OPaJVietH+rZtEeVcqoAawYbp1HFQNNYA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040