UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D6Sgx1a28YQ40yovf3m9GN9YoA9Ey+LBBjRrCT63Nnk=' 
WHERE 
  key_id = 'd50aa77df863956ba167bf5ac5d2d07f78515cd0ebc8f9a8a6038882ab606218' 
  AND (
    token = 'D6Sgx1a28YQ40yovf3m9GN9YoA9Ey+LBBjRrCT63Nnk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038