UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T9W6X3cgW7mBxJQx2FfaiShHzmxyfI76AeAJafCm3Zw=' 
WHERE 
  key_id = '92a481749215075c8dbd48915995ef883c43233e8f417afb849821811300a645' 
  AND (
    token = 'T9W6X3cgW7mBxJQx2FfaiShHzmxyfI76AeAJafCm3Zw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028