UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lt4C1C4NhPnd+XlxkMCMxJ2eOM7HTJRMMr27OrU6GRs=' 
WHERE 
  key_id = '30d249d0c53ed034e0e1c6abb457e885b1f50b12a7cbb6a6c3aaa001a3dc3681' 
  AND (
    token = 'lt4C1C4NhPnd+XlxkMCMxJ2eOM7HTJRMMr27OrU6GRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040