UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XR21L2xUlbThf4mlhTk5L8ot0Q87xljhHiX5rGcjf/g=' 
WHERE 
  key_id = '209e545e718fffe729f26ad0e3f26ebfe92be2560560060c8ff8555f51c338c3' 
  AND (
    token = 'XR21L2xUlbThf4mlhTk5L8ot0Q87xljhHiX5rGcjf/g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040