UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZRS/cpQeDqwQbe3P6YWUyrkeX22Vv5e2anw7pWkUHXM=' 
WHERE 
  key_id = '5f34d816ce00184791285863f28a7631cf7247e99a0825f53c94e9819f3f00cc' 
  AND (
    token = 'ZRS/cpQeDqwQbe3P6YWUyrkeX22Vv5e2anw7pWkUHXM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025