UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J9yJdqpRHyJaw7wVk8P89ixJauctLMTqqJNnQDXmHbc=' 
WHERE 
  key_id = 'b589a139761eec823a8a0bf650fe05f9755030d9278aa2e78a98621f836f42cc' 
  AND (
    token = 'J9yJdqpRHyJaw7wVk8P89ixJauctLMTqqJNnQDXmHbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029