UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DjW2pCFxY2VJCs2heZVLshfeETKWEIUa+9rtYrZXShI=' 
WHERE 
  key_id = '96f52fc5436a4a6050b74ee0f61a7cbe3ca16965d6dd4fc53bca39d49f34641e' 
  AND (
    token = 'DjW2pCFxY2VJCs2heZVLshfeETKWEIUa+9rtYrZXShI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025