UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IeCIT1tTRVFGJIi7ocHo+LwNK0C6fA6nxN6ovRWtnTc=' 
WHERE 
  key_id = '7ac7697d51686dbcf0463bdd8eb0501e1c42ea5db6f735aa88a1e8a81d4af887' 
  AND (
    token = 'IeCIT1tTRVFGJIi7ocHo+LwNK0C6fA6nxN6ovRWtnTc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042