UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zty/zis3Ck4ldKd6MategMoOKMfvRlyLokh47JE5dgs=' 
WHERE 
  key_id = '8eb38b25d1373988be044c821cc567fcf62b494a8a750d367858f29382b00d80' 
  AND (
    token = 'Zty/zis3Ck4ldKd6MategMoOKMfvRlyLokh47JE5dgs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039