UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a5ssruiBz+FQRXgWx5QeOG6k3posNpuS75IA+Q8WOPQ=' 
WHERE 
  key_id = '7b82bb15edb15996aa23acc2b66c8ce03ba7c897cf440a68466f06d8171f91f6' 
  AND (
    token = 'a5ssruiBz+FQRXgWx5QeOG6k3posNpuS75IA+Q8WOPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027