UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K+gaiqfwVA0C2Uh5qcSWBv4kFPmtLSQBj6QW6d43I6k=' 
WHERE 
  key_id = '76db383a0efd15384f5eecc6c2193c3cb5fcda8cca6d5a06b66b1147c1b03b40' 
  AND (
    token = 'K+gaiqfwVA0C2Uh5qcSWBv4kFPmtLSQBj6QW6d43I6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031