UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vXdx1gTHRlvz3uTuFe0joaM8HOlFS8kU0HjWZgkIPzg=' 
WHERE 
  key_id = '6f525743b91631c45ccccc193a81b7cacaf4828a54328149d24e2a545c3c385e' 
  AND (
    token = 'vXdx1gTHRlvz3uTuFe0joaM8HOlFS8kU0HjWZgkIPzg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034