UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mhUsHf6Rbv2LZyaqFXGLL6CpXxbibaYt38+JJmLiMBk=' 
WHERE 
  key_id = 'f9f3c6ed8fe28de6c9a20fb07a2e6b5665d2873803a31dcbabdaec2d98d07bb2' 
  AND (
    token = 'mhUsHf6Rbv2LZyaqFXGLL6CpXxbibaYt38+JJmLiMBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037