UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n83j2rp0UnTUnAuzhqmrkmdDhVFQ4gOsUdWgiwrExfw=' 
WHERE 
  key_id = '06b2ed2f39433664ed966add21c98df28d437f0e6bc74ebfc8c427880a7d98ef' 
  AND (
    token = 'n83j2rp0UnTUnAuzhqmrkmdDhVFQ4gOsUdWgiwrExfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020