UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NfbQsC0s4YDRyiitODJvSUVdNUfYY/zGiwgM2PE+w0A=' 
WHERE 
  key_id = '0dee8deae030e43fbcbfea1581790450ba9ae95d8094c8b384d22ecbb6a21585' 
  AND (
    token = 'NfbQsC0s4YDRyiitODJvSUVdNUfYY/zGiwgM2PE+w0A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034