UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'grO0/XXb+uatqrOhruCCmiGCbcfG+QsF4y+Z3bpxsG4=' 
WHERE 
  key_id = '667f8ded3f70b8213f688160016d67dd5a86ea0e0d6c7d5ba5ebe4b005db6c99' 
  AND (
    token = 'grO0/XXb+uatqrOhruCCmiGCbcfG+QsF4y+Z3bpxsG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052