UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '53YxEGY+1SXkDyCGBnYC4WQK2vmgIu654564Cra4Tmk=' 
WHERE 
  key_id = '6316d4347fe325a3beccf266ab7851938edce9695fe27130c1c3a62b601124f5' 
  AND (
    token = '53YxEGY+1SXkDyCGBnYC4WQK2vmgIu654564Cra4Tmk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032