UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dw9DxGen2UL23Zp+k4bEMKSxuLyuLkuZAXVjlyJbjhU=' 
WHERE 
  key_id = '5d75a9d558fe93dd120e463da64f4fe582a4c0b58b0cfde012fc71f9e2051057' 
  AND (
    token = 'Dw9DxGen2UL23Zp+k4bEMKSxuLyuLkuZAXVjlyJbjhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027